<%@ page pageEncoding="UTF-8"%>
<%@ taglib prefix="isperp" uri="/WEB-INF/tlds/isperp.tld"%>

<script type="text/javascript">
	function systemHelpTree_onNodeClick(event, treeId, treeNode) {
		//alert(treeNode.treenodePath);
		//alert(	JSON.stringify(treeNode));

		systemHelpGrid.search({
			"field" : "parent_id",
			"op" : "eq",
			"data" : treeNode.id
		});
	}
	
	function getMenuTreeNode() {
		var node = systemHelpTree.zTree.getSelectedNodes();

		if (node !=undefined) {
			return "parentId=" + node[0].id;
		}
		$.jGrowl("请选择节点！", {
			position : "center",
			sticky : true
		});
		return false;
	}
</script>


<div class="container_0 clearfix">
	<div class="box-left">
		<isperp:tree cusDialogSize="big" id="systemHelpTree"
			cusEditUrl="app/systemHelp/edit" cusDeleteUrl="app/systemHelp/delete">
			<isperp:async enable="true" url="app/systemHelp/getTree">
			</isperp:async>
			<isperp:callback onClick="systemHelpTree_onNodeClick">
			</isperp:callback>
			<isperp:edit enable="true" showRemoveBtn="false"
				showRenameBtn="false"></isperp:edit>
			<isperp:view showTitle="false" addHoverDom="true"
				removeHoverDom="true"></isperp:view>
		</isperp:tree>
	</div>
	<div class="box-right">
		<div class="box no-border">
			<div class="header">
				<h2>系统菜单</h2>
			</div>

			<isperp:grid url="app/systemHelp/list" gridId="systemHelpGrid"
				gridTitle="${pageTitle}" cusFormatterActions="true"
				cusDialogSize="big" cusEditUrl="app/systemHelp/edit"
				showSearchbar="false" cusDeleteUrl="app/systemHelp/delete"
				ondbClickRowEvent="systemHelpGrid.edit(rowid);"
				beforeCreateAction="getMenuTreeNode();"
				afterActionsSuccess="systemHelpTree.reload();">
				<jsp:attribute name="toolbar">
	 				<isperp:toolbar id="systemHelpToolbar">
		 				<isperp:button id="systemHelpCreate" icon="icon-plus"
							text="新增下级菜单" onclick="systemHelpGrid.create();"></isperp:button>
		 				<isperp:button id="systemHelpEdit" icon="icon-download"
							text="导出到Excel" onclick="systemHelpGrid.excelExport();"></isperp:button>
	 				</isperp:toolbar>
				 </jsp:attribute>

				<jsp:attribute name="searchbar">
					<table class="search-table">
						<tbody>
							<tr>
								<td>名称：</td>
								<td><input type="text" field="name" op="cn">
								</td>
								<td>路径：</td>
								<td><input type="text" field="treenodeNamePath" op="cn">
								</td>
							</tr>
	
						</tbody>
					</table>
				</jsp:attribute>
				<jsp:body> 
					<isperp:column name="id" title="id" hidden="true"></isperp:column>
					<isperp:column name="name" title="名称" width="100">
					</isperp:column>
					<isperp:column name="code" title="编码" width="100">
					</isperp:column>
					<isperp:column name="treenodeNamePath" title="路径" width="200">
					</isperp:column>
					 
					<isperp:column name="open" title="展开" width="50" align="center"
						formatter="checkbox">
					</isperp:column>
				</jsp:body>

			</isperp:grid>
		</div>
	</div>
</div>
